home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / Devices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-15  |  23.7 KB  |  687 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Devices.h
  3.  
  4.      Contains:    Device Manager Interfaces.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2.
  7.                  Package:    Universal Interfaces 2.1.2 on ETO #20
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __DEVICES__
  21. #define __DEVICES__
  22.  
  23.  
  24. #ifndef __OSUTILS__
  25. #include <OSUtils.h>
  26. #endif
  27. /*    #include <Types.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <MixedMode.h>                                        */
  30. /*    #include <Memory.h>                                            */
  31.  
  32. #ifndef __FILES__
  33. #include <Files.h>
  34. #endif
  35. /*    #include <Finder.h>                                            */
  36.  
  37. #ifndef __QUICKDRAW__
  38. #include <Quickdraw.h>
  39. #endif
  40. /*    #include <QuickdrawText.h>                                    */
  41.  
  42. #ifndef __EVENTS__
  43. #include <Events.h>
  44. #endif
  45.  
  46. #ifndef __DIALOGS__
  47. #include <Dialogs.h>
  48. #endif
  49. /*    #include <Errors.h>                                            */
  50. /*    #include <Menus.h>                                            */
  51. /*    #include <Controls.h>                                        */
  52. /*    #include <Windows.h>                                        */
  53. /*    #include <TextEdit.h>                                        */
  54.  
  55. #ifndef __KERNEL__
  56. #include <Kernel.h>
  57. #endif
  58.  
  59. #ifndef __NAMEREGISTRY__
  60. #include <NameRegistry.h>
  61. #endif
  62.  
  63. #ifndef __CODEFRAGMENTS__
  64. #include <CodeFragments.h>
  65. #endif
  66.  
  67. #ifdef __cplusplus
  68. extern "C" {
  69. #endif
  70.  
  71. #if PRAGMA_ALIGN_SUPPORTED
  72. #pragma options align=mac68k
  73. #endif
  74.  
  75. #if PRAGMA_IMPORT_SUPPORTED
  76. #pragma import on
  77. #endif
  78.  
  79.  
  80. enum {
  81.     chooserInitMsg                = 11,                            /* the user selected this device package */
  82.     newSelMsg                    = 12,                            /* the user made new device selections */
  83.     fillListMsg                    = 13,                            /* fill the device list with choices */
  84.     getSelMsg                    = 14,                            /* mark one or more choices as selected */
  85.     selectMsg                    = 15,                            /* the user made a selection */
  86.     deselectMsg                    = 16,                            /* the user canceled a selection */
  87.     terminateMsg                = 17,                            /* allows device package to clean up */
  88.     buttonMsg                    = 19                            /* the user selected a button */
  89. };
  90.  
  91. /* Values of the 'caller' parameter to a Chooser device package */
  92. enum {
  93.     chooserID                    = 1
  94. };
  95.  
  96. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  97. enum {
  98.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  99.     hitDev                        = 1,                            /*Hit on one of my items*/
  100.     closeDev                    = 2,                            /*Close yourself*/
  101.     nulDev                        = 3,                            /*Null event*/
  102.     updateDev                    = 4,                            /*Update event*/
  103.     activDev                    = 5,                            /*Activate event*/
  104.     deactivDev                    = 6,                            /*Deactivate event*/
  105.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  106.     macDev                        = 8,                            /*Decide whether or not to show up*/
  107.     undoDev                        = 9,
  108.     cutDev                        = 10,
  109.     copyDev                        = 11,
  110.     pasteDev                    = 12,
  111.     clearDev                    = 13,
  112.     cursorDev                    = 14
  113. };
  114.  
  115. /* Special values a Control Panel 'cdev' can return */
  116. enum {
  117.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  118.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  119.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  120.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  121. };
  122.  
  123. /* Values of the 'message' parameter to a Monitor 'mntr' */
  124. enum {
  125.     initMsg                        = 1,                            /*initialization*/
  126.     okMsg                        = 2,                            /*user clicked OK button*/
  127.     cancelMsg                    = 3,                            /*user clicked Cancel button*/
  128.     hitMsg                        = 4,                            /*user clicked control in Options dialog*/
  129.     nulMsg                        = 5,                            /*periodic event*/
  130.     updateMsg                    = 6,                            /*update event*/
  131.     activateMsg                    = 7,                            /*not used*/
  132.     deactivateMsg                = 8,                            /*not used*/
  133.     keyEvtMsg                    = 9,                            /*keyboard event*/
  134.     superMsg                    = 10,                            /*show superuser controls*/
  135.     normalMsg                    = 11,                            /*show only normal controls*/
  136.     startupMsg                    = 12                            /*code has been loaded*/
  137. };
  138.  
  139. /* control codes for DeskAccessories */
  140. enum {
  141.     goodbye                        = -1,                            /* heap being reinitialized */
  142.     killCode                    = 1,                            /* KillIO requested */
  143.     accEvent                    = 64,                            /* handle an event */
  144.     accRun                        = 65,                            /* time for periodic action */
  145.     accCursor                    = 66,                            /* change cursor shape */
  146.     accMenu                        = 67,                            /* handle menu item */
  147.     accUndo                        = 68,                            /* handle undo command */
  148.     accCut                        = 70,                            /* handle cut command */
  149.     accCopy                        = 71,                            /* handle copy command */
  150.     accPaste                    = 72,                            /* handle paste command */
  151.     accClear                    = 73                            /* handle clear command */
  152. };
  153.  
  154. /* Control/Status Call Codes */
  155. enum {
  156.     drvStsCode                    = 8,                            /* status call code for drive status */
  157.     ejectCode                    = 7,                            /* control call eject code */
  158.     tgBuffCode                    = 8                                /* set tag buffer code */
  159. };
  160.  
  161. /* miscellaneous Device Manager constants */
  162. enum {
  163.     ioInProgress                = 1,                            /* predefined value of ioResult while I/O is pending */
  164.     aRdCmd                        = 2,                            /* low byte of ioTrap for Read calls */
  165.     aWrCmd                        = 3,                            /* low byte of ioTrap for Write calls */
  166.     asyncTrpBit                    = 10,                            /* trap word modifier */
  167.     noQueueBit                    = 9                                /* trap word modifier */
  168. };
  169.  
  170. /* flags used in the driver header and device control entry */
  171. enum {
  172.     dReadEnable                    = 0,                            /* set if driver responds to read requests */
  173.     dWritEnable                    = 1,                            /* set if driver responds to write requests */
  174.     dCtlEnable                    = 2,                            /* set if driver responds to control requests */
  175.     dStatEnable                    = 3,                            /* set if driver responds to status requests */
  176.     dNeedGoodBye                = 4,                            /* set if driver needs time for performing periodic tasks */
  177.     dNeedTime                    = 5,                            /* set if driver needs time for performing periodic tasks */
  178.     dNeedLock                    = 6,                            /* set if driver must be locked in memory as soon as it is opened */
  179.     dNeedLockMask                = 0x4000,                        /* set if driver must be locked in memory as soon as it is opened */
  180.     dNeedTimeMask                = 0x2000,                        /* set if driver needs time for performing periodic tasks */
  181.     dNeedGoodByeMask            = 0x1000,                        /* set if driver needs to be called before the application heap is initialized */
  182.     dStatEnableMask                = 0x0800,                        /* set if driver responds to status requests */
  183.     dCtlEnableMask                = 0x0400,                        /* set if driver responds to control requests */
  184.     dWritEnableMask                = 0x0200,                        /* set if driver responds to write requests */
  185.     dReadEnableMask                = 0x0100                        /* set if driver responds to read requests */
  186. };
  187.  
  188. /* run-time flags used in the device control entry */
  189. enum {
  190.     dOpened                        = 5,                            /* driver is open */
  191.     dRAMBased                    = 6,                            /* dCtlDriver is a handle (1) or pointer (0) */
  192.     drvrActive                    = 7,                            /* driver is currently processing a request */
  193.     drvrActiveMask                = 0x0080,                        /* driver is currently processing a request */
  194.     dRAMBasedMask                = 0x0040,                        /* dCtlDriver is a handle (1) or pointer (0) */
  195.     dOpenedMask                    = 0x0020                        /* driver is open */
  196. };
  197.  
  198. struct DRVRHeader {
  199.     short                            drvrFlags;
  200.     short                            drvrDelay;
  201.     short                            drvrEMask;
  202.     short                            drvrMenu;
  203.     short                            drvrOpen;
  204.     short                            drvrPrime;
  205.     short                            drvrCtl;
  206.     short                            drvrStatus;
  207.     short                            drvrClose;
  208.     unsigned char                    drvrName[1];
  209. };
  210. typedef struct DRVRHeader DRVRHeader;
  211.  
  212. typedef DRVRHeader *DRVRHeaderPtr, **DRVRHeaderHandle;
  213.  
  214. struct DCtlEntry {
  215.     Ptr                                dCtlDriver;
  216.     short                            dCtlFlags;
  217.     QHdr                            dCtlQHdr;
  218.     long                            dCtlPosition;
  219.     Handle                            dCtlStorage;
  220.     short                            dCtlRefNum;
  221.     long                            dCtlCurTicks;
  222.     WindowPtr                        dCtlWindow;
  223.     short                            dCtlDelay;
  224.     short                            dCtlEMask;
  225.     short                            dCtlMenu;
  226. };
  227. typedef struct DCtlEntry DCtlEntry;
  228.  
  229. typedef DCtlEntry *DCtlPtr, **DCtlHandle;
  230.  
  231. struct AuxDCE {
  232.     Ptr                                dCtlDriver;
  233.     short                            dCtlFlags;
  234.     QHdr                            dCtlQHdr;
  235.     long                            dCtlPosition;
  236.     Handle                            dCtlStorage;
  237.     short                            dCtlRefNum;
  238.     long                            dCtlCurTicks;
  239.     GrafPtr                            dCtlWindow;
  240.     short                            dCtlDelay;
  241.     short                            dCtlEMask;
  242.     short                            dCtlMenu;
  243.     SInt8                            dCtlSlot;
  244.     SInt8                            dCtlSlotId;
  245.     long                            dCtlDevBase;
  246.     Ptr                                dCtlOwner;
  247.     SInt8                            dCtlExtDev;
  248.     SInt8                            fillByte;
  249.     UInt32                            dCtlNodeID;
  250. };
  251. typedef struct AuxDCE AuxDCE;
  252.  
  253. typedef AuxDCE *AuxDCEPtr, **AuxDCEHandle;
  254.  
  255. typedef UInt16 UnitNumber;
  256.  
  257. typedef UInt32 DriverOpenCount;
  258.  
  259. typedef SInt16 DriverRefNum;
  260.  
  261. typedef SInt16 DriverFlags;
  262.  
  263. typedef UInt32 IOCommandCode;
  264.  
  265.  
  266. enum {
  267.     kOpenCommand                = 0,
  268.     kCloseCommand                = 1,
  269.     kReadCommand                = 2,
  270.     kWriteCommand                = 3,
  271.     kControlCommand                = 4,
  272.     kStatusCommand                = 5,
  273.     kKillIOCommand                = 6,
  274.     kInitializeCommand            = 7,                            /* init driver and device*/
  275.     kFinalizeCommand            = 8,                            /* shutdown driver and device*/
  276.     kReplaceCommand                = 9,                            /* replace an old driver*/
  277.     kSupersededCommand            = 10                            /* prepare to be replaced by a new driver*/
  278. };
  279.  
  280. typedef KernelID IOCommandID;
  281.  
  282. typedef UInt32 IOCommandKind;
  283.  
  284.  
  285. enum {
  286.     kSynchronousIOCommandKind    = 0x00000001,
  287.     kAsynchronousIOCommandKind    = 0x00000002,
  288.     kImmediateIOCommandKind        = 0x00000004
  289. };
  290.  
  291. struct DriverInitInfo {
  292.     DriverRefNum                    refNum;
  293.     RegEntryID                        deviceEntry;
  294. };
  295. struct DriverFinalInfo {
  296.     DriverRefNum                    refNum;
  297.     RegEntryID                        deviceEntry;
  298. };
  299. typedef struct DriverInitInfo DriverInitInfo, *DriverInitInfoPtr;
  300.  
  301. typedef struct DriverInitInfo DriverReplaceInfo, *DriverReplaceInfoPtr;
  302.  
  303. typedef struct DriverFinalInfo DriverFinalInfo, *DriverFinalInfoPtr;
  304.  
  305. typedef struct DriverFinalInfo DriverSupersededInfo, *DriverSupersededInfoPtr;
  306.  
  307. /* Contents are command specific*/
  308. union IOCommandContents {
  309.     ParmBlkPtr                        pb;
  310.     DriverInitInfoPtr                initialInfo;
  311.     DriverFinalInfoPtr                finalInfo;
  312.     DriverReplaceInfoPtr            replaceInfo;
  313.     DriverSupersededInfoPtr            supersededInfo;
  314. };
  315. typedef union IOCommandContents IOCommandContents;
  316.  
  317. typedef OSErr (DriverEntryPoint)(AddressSpaceID SpaceID, IOCommandID CommandID, IOCommandContents Contents, IOCommandCode Code, IOCommandKind Kind);
  318. typedef DriverEntryPoint *DriverEntryPointPtr;
  319.  
  320. /* Driver Typing Information Used to Match Drivers With Devices */
  321. struct DriverType {
  322.     Str31                            nameInfoStr;                /* Driver Name/Info String*/
  323.     NumVersion                        version;                    /* Driver Version Number*/
  324. };
  325. typedef struct DriverType DriverType, *DriverTypePtr;
  326.  
  327. /* OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment */
  328. typedef OptionBits RuntimeOptions;
  329.  
  330.  
  331. enum {
  332.     kDriverIsLoadedUponDiscovery = 0x00000001,                    /* auto-load driver when discovered*/
  333.     kDriverIsOpenedUponLoad        = 0x00000002,                    /* auto-open driver when loaded*/
  334.     kDriverIsUnderExpertControl    = 0x00000004,                    /* I/O expert handles loads/opens*/
  335.     kDriverIsConcurrent            = 0x00000008,                    /* supports concurrent requests*/
  336.     kDriverQueuesIOPB            = 0x00000010                    /* device manager doesn't queue IOPB*/
  337. };
  338.  
  339. struct DriverOSRuntime {
  340.     RuntimeOptions                    driverRuntime;                /* Options for OS Runtime*/
  341.     Str31                            driverName;                    /* Driver's name to the OS*/
  342.     UInt32                            driverDescReserved[8];        /* Reserved area*/
  343. };
  344. typedef struct DriverOSRuntime DriverOSRuntime, *DriverOSRuntimePtr;
  345.  
  346. /* OS Service Information Used To Declare What APIs a Driver Supports */
  347. typedef UInt32 ServiceCount;
  348.  
  349. struct DriverServiceInfo {
  350.     OSType                            serviceCategory;            /* Service Category Name*/
  351.     OSType                            serviceType;                /* Type within Category*/
  352.     NumVersion                        serviceVersion;                /* Version of service*/
  353. };
  354. typedef struct DriverServiceInfo DriverServiceInfo, *DriverServiceInfoPtr;
  355.  
  356. struct DriverOSService {
  357.     ServiceCount                    nServices;                    /* Number of Services Supported*/
  358.     DriverServiceInfo                service[1];                    /* The List of Services (at least one)*/
  359. };
  360. typedef struct DriverOSService DriverOSService, *DriverOSServicePtr;
  361.  
  362. /* Categories */
  363.  
  364. enum {
  365.     kServiceCategoryDisplay        = 'disp',                        /* Display Manager*/
  366.     kServiceCategoryOpenTransport = 'otan',                        /* Open Transport*/
  367.     kServiceCategoryBlockStorage = 'blok',                        /* Block Storage*/
  368.     kServiceCategoryNdrvDriver    = 'ndrv',                        /* Generic Native Driver*/
  369.     kServiceCategoryScsiSIM        = 'scsi'
  370. };
  371.  
  372. /* Ndrv ServiceCategory Types */
  373. enum {
  374.     kNdrvTypeIsGeneric            = 'genr',                        /* generic*/
  375.     kNdrvTypeIsVideo            = 'vido',                        /* video*/
  376.     kNdrvTypeIsBlockStorage        = 'blok',                        /* block storage*/
  377.     kNdrvTypeIsNetworking        = 'netw',                        /* networking*/
  378.     kNdrvTypeIsSerial            = 'serl',                        /* serial*/
  379.     kNdrvTypeIsSound            = 'sond',                        /* sound*/
  380.     kNdrvTypeIsBusBridge        = 'brdg'
  381. };
  382.  
  383. /*    The Driver Description */
  384. enum {
  385.     kTheDescriptionSignature    = 'mtej'
  386. };
  387.  
  388. typedef UInt32 DriverDescVersion;
  389.  
  390.  
  391. enum {
  392.     kInitialDriverDescriptor    = 0
  393. };
  394.  
  395. struct DriverDescription {
  396.     OSType                            driverDescSignature;        /* Signature field of this structure*/
  397.     DriverDescVersion                driverDescVersion;            /* Version of this data structure*/
  398.     DriverType                        driverType;                    /* Type of Driver*/
  399.     DriverOSRuntime                    driverOSRuntimeInfo;        /* OS Runtime Requirements of Driver*/
  400.     DriverOSService                    driverServices;                /* Apple Service API Membership*/
  401. };
  402. typedef struct DriverDescription DriverDescription, *DriverDescriptionPtr;
  403.  
  404. /* Record to describe a file-based driver candidate */
  405. struct FileBasedDriverRecord {
  406.     FSSpec                            theSpec;                    /* file specification*/
  407.     DriverType                        theType;                    /* nameInfoStr + version number*/
  408.     Boolean                            compatibleProp;                /* true if matched using a compatible name*/
  409.     UInt8                            pad[3];                        /* alignment*/
  410. };
  411. typedef struct FileBasedDriverRecord FileBasedDriverRecord, *FileBasedDriverRecordPtr;
  412.  
  413. /* Driver Loader API */
  414. #define DECLARE_DRIVERDESCRIPTION(N_ADDITIONAL_SERVICES)  \
  415.     struct {                    \
  416.     DriverDescription    fixed;    \
  417.     DriverServiceInfo    additional_service[N_ADDITIONAL_SERVICES-1]; \
  418.     };
  419. extern SInt16 HigherDriverVersion(NumVersion *driverVersion1, NumVersion *driverVersion2);
  420. extern OSErr VerifyFragmentAsDriver(CFragConnectionID fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  421. extern OSErr GetDriverMemoryFragment(Ptr memAddr, long length, ConstStr63Param fragName, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  422. extern OSErr GetDriverDiskFragment(FSSpecPtr fragmentSpec, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  423. extern OSErr InstallDriverFromFragment(CFragConnectionID fragmentConnID, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  424. extern OSErr InstallDriverFromFile(FSSpecPtr fragmentSpec, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  425. extern OSErr InstallDriverFromMemory(Ptr memory, long length, ConstStr63Param fragName, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  426. extern OSErr InstallDriverFromDisk(Ptr theDriverName, RegEntryIDPtr theDevice, UnitNumber theBeginningUnit, UnitNumber theEndingUnit, DriverRefNum *theRefNum);
  427. extern OSErr FindDriversForDevice(RegEntryIDPtr device, FSSpec *fragmentSpec, DriverDescription *fileDriverDesc, Ptr *memAddr, long *length, StringPtr fragName, DriverDescription *memDriverDesc);
  428. extern OSErr FindDriverCandidates(RegEntryIDPtr deviceID, Ptr *propBasedDriver, RegPropertyValueSize *propBasedDriverSize, StringPtr deviceName, DriverType *propBasedDriverType, Boolean *gotPropBasedDriver, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount *nFileBasedDrivers);
  429. extern OSErr ScanDriverCandidates(RegEntryIDPtr deviceID, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount nFileBasedDrivers, FileBasedDriverRecordPtr matchingDrivers, ItemCount *nMatchingDrivers);
  430. extern OSErr GetDriverForDevice(RegEntryIDPtr device, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  431. extern OSErr InstallDriverForDevice(RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  432. extern OSErr SetDriverClosureMemory(CFragConnectionID fragmentConnID, Boolean holdDriverMemory);
  433. extern OSErr ReplaceDriverWithFragment(DriverRefNum theRefNum, CFragConnectionID fragmentConnID);
  434. extern OSErr GetDriverInformation(DriverRefNum refNum, UnitNumber *unitNum, DriverFlags *flags, DriverOpenCount *count, StringPtr name, RegEntryID *device, CFragHFSLocator *driverLoadLocation, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescription *driverDesc);
  435. extern OSErr OpenInstalledDriver(DriverRefNum refNum, SInt8 ioPermission);
  436. extern OSErr RenameDriver(DriverRefNum refNum, StringPtr newDriverName);
  437. extern OSErr RemoveDriver(DriverRefNum refNum, Boolean immediate);
  438. extern OSErr LookupDrivers(UnitNumber beginningUnit, UnitNumber endingUnit, Boolean emptyUnits, ItemCount *returnedRefNums, DriverRefNum *refNums);
  439. extern UnitNumber HighestUnitNumber(void);
  440. extern OSErr DriverGestaltOn(DriverRefNum refNum);
  441. extern OSErr DriverGestaltOff(DriverRefNum refNum);
  442. extern Boolean DriverGestaltIsOn(DriverFlags flags);
  443.  
  444. #if !OLDROUTINELOCATIONS
  445.  
  446. #if !GENERATINGCFM
  447. #pragma parameter __D0 PBOpenSync(__A0)
  448. #endif
  449. extern pascal OSErr PBOpenSync(ParmBlkPtr paramBlock)
  450.  ONEWORDINLINE(0xA000);
  451.  
  452. #if !GENERATINGCFM
  453. #pragma parameter __D0 PBOpenAsync(__A0)
  454. #endif
  455. extern pascal OSErr PBOpenAsync(ParmBlkPtr paramBlock)
  456.  ONEWORDINLINE(0xA400);
  457.  
  458. #if !GENERATINGCFM
  459. #pragma parameter __D0 PBOpenImmed(__A0)
  460. #endif
  461. extern pascal OSErr PBOpenImmed(ParmBlkPtr paramBlock)
  462.  ONEWORDINLINE(0xA200);
  463.  
  464. #if !GENERATINGCFM
  465. #pragma parameter __D0 PBCloseSync(__A0)
  466. #endif
  467. extern pascal OSErr PBCloseSync(ParmBlkPtr paramBlock)
  468.  ONEWORDINLINE(0xA001);
  469.  
  470. #if !GENERATINGCFM
  471. #pragma parameter __D0 PBCloseAsync(__A0)
  472. #endif
  473. extern pascal OSErr PBCloseAsync(ParmBlkPtr paramBlock)
  474.  ONEWORDINLINE(0xA401);
  475.  
  476. #if !GENERATINGCFM
  477. #pragma parameter __D0 PBCloseImmed(__A0)
  478. #endif
  479. extern pascal OSErr PBCloseImmed(ParmBlkPtr paramBlock)
  480.  ONEWORDINLINE(0xA201);
  481.  
  482. #if !GENERATINGCFM
  483. #pragma parameter __D0 PBReadSync(__A0)
  484. #endif
  485. extern pascal OSErr PBReadSync(ParmBlkPtr paramBlock)
  486.  ONEWORDINLINE(0xA002);
  487.  
  488. #if !GENERATINGCFM
  489. #pragma parameter __D0 PBReadAsync(__A0)
  490. #endif
  491. extern pascal OSErr PBReadAsync(ParmBlkPtr paramBlock)
  492.  ONEWORDINLINE(0xA402);
  493.  
  494. #if !GENERATINGCFM
  495. #pragma parameter __D0 PBReadImmed(__A0)
  496. #endif
  497. extern pascal OSErr PBReadImmed(ParmBlkPtr paramBlock)
  498.  ONEWORDINLINE(0xA202);
  499.  
  500. #if !GENERATINGCFM
  501. #pragma parameter __D0 PBWriteSync(__A0)
  502. #endif
  503. extern pascal OSErr PBWriteSync(ParmBlkPtr paramBlock)
  504.  ONEWORDINLINE(0xA003);
  505.  
  506. #if !GENERATINGCFM
  507. #pragma parameter __D0 PBWriteAsync(__A0)
  508. #endif
  509. extern pascal OSErr PBWriteAsync(ParmBlkPtr paramBlock)
  510.  ONEWORDINLINE(0xA403);
  511.  
  512. #if !GENERATINGCFM
  513. #pragma parameter __D0 PBWriteImmed(__A0)
  514. #endif
  515. extern pascal OSErr PBWriteImmed(ParmBlkPtr paramBlock)
  516.  ONEWORDINLINE(0xA203);
  517. extern pascal void AddDrive(short drvrRefNum, short drvNum, DrvQElPtr qEl);
  518. extern pascal QHdrPtr GetDrvQHdr(void)
  519.  THREEWORDINLINE(0x2EBC, 0x0000, 0x0308);
  520. #endif
  521. /* Control Panel Default Proc */
  522. typedef pascal long (*ControlPanelDefProcPtr)(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  523.  
  524. #if GENERATINGCFM
  525. typedef UniversalProcPtr ControlPanelDefUPP;
  526. #else
  527. typedef ControlPanelDefProcPtr ControlPanelDefUPP;
  528. #endif
  529.  
  530. enum {
  531.     uppControlPanelDefProcInfo = kPascalStackBased
  532.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  533.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  534.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  535.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  536.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  537.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(EventRecord*)))
  538.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(long)))
  539.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(DialogPtr)))
  540. };
  541.  
  542. #if GENERATINGCFM
  543. #define NewControlPanelDefProc(userRoutine)        \
  544.         (ControlPanelDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  545. #else
  546. #define NewControlPanelDefProc(userRoutine)        \
  547.         ((ControlPanelDefUPP) (userRoutine))
  548. #endif
  549.  
  550. #if GENERATINGCFM
  551. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)        \
  552.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  553. #else
  554. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)        \
  555.         (*(userRoutine))((message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  556. #endif
  557.  
  558. extern pascal DCtlHandle GetDCtlEntry(short refNum);
  559. /*
  560.     SetChooserAlert used to simply set a bit in a low-mem global
  561.     to tell the Chooser not to display its warning message when
  562.     the printer is changed. However, under MultiFinder and System 7,
  563.     this low-mem is swapped out when a layer change occurs, and the
  564.     Chooser never sees the change. It is obsolete, and completely
  565.     unsupported on the PowerPC. 68K apps can still call it if they
  566.     wish.
  567. */
  568. #if OLDROUTINENAMES && !GENERATINGCFM
  569. extern pascal Boolean SetChooserAlert(Boolean f);
  570. #endif
  571.  
  572. #if !GENERATINGCFM
  573. #pragma parameter __D0 DriverInstall(__A0, __D0)
  574. #endif
  575. extern pascal OSErr DriverInstall(DRVRHeaderPtr drvrPtr, short refNum)
  576.  ONEWORDINLINE(0xA03D);
  577.  
  578. #if !GENERATINGCFM
  579. #pragma parameter __D0 DriverInstallReserveMem(__A0, __D0)
  580. #endif
  581. extern pascal OSErr DriverInstallReserveMem(DRVRHeaderPtr drvrPtr, short refNum)
  582.  ONEWORDINLINE(0xA43D);
  583.  
  584. #if !GENERATINGCFM
  585. #pragma parameter __D0 DrvrRemove(__D0)
  586. #endif
  587. extern pascal OSErr DrvrRemove(short refNum)
  588.  ONEWORDINLINE(0xA03E);
  589. #define DriverRemove(refNum) DrvrRemove(refNum)
  590. extern pascal OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum);
  591. extern pascal OSErr CloseDriver(short refNum);
  592. extern pascal OSErr Control(short refNum, short csCode, const void *csParamPtr);
  593. extern pascal OSErr Status(short refNum, short csCode, void *csParamPtr);
  594. extern pascal OSErr KillIO(short refNum);
  595.  
  596. #if !GENERATINGCFM
  597. #pragma parameter __D0 PBControlSync(__A0)
  598. #endif
  599. extern pascal OSErr PBControlSync(ParmBlkPtr paramBlock)
  600.  ONEWORDINLINE(0xA004);
  601.  
  602. #if !GENERATINGCFM
  603. #pragma parameter __D0 PBControlAsync(__A0)
  604. #endif
  605. extern pascal OSErr PBControlAsync(ParmBlkPtr paramBlock)
  606.  ONEWORDINLINE(0xA404);
  607.  
  608. #if !GENERATINGCFM
  609. #pragma parameter __D0 PBControlImmed(__A0)
  610. #endif
  611. extern pascal OSErr PBControlImmed(ParmBlkPtr paramBlock)
  612.  ONEWORDINLINE(0xA204);
  613.  
  614. #if !GENERATINGCFM
  615. #pragma parameter __D0 PBStatusSync(__A0)
  616. #endif
  617. extern pascal OSErr PBStatusSync(ParmBlkPtr paramBlock)
  618.  ONEWORDINLINE(0xA005);
  619.  
  620. #if !GENERATINGCFM
  621. #pragma parameter __D0 PBStatusAsync(__A0)
  622. #endif
  623. extern pascal OSErr PBStatusAsync(ParmBlkPtr paramBlock)
  624.  ONEWORDINLINE(0xA405);
  625.  
  626. #if !GENERATINGCFM
  627. #pragma parameter __D0 PBStatusImmed(__A0)
  628. #endif
  629. extern pascal OSErr PBStatusImmed(ParmBlkPtr paramBlock)
  630.  ONEWORDINLINE(0xA205);
  631.  
  632. #if !GENERATINGCFM
  633. #pragma parameter __D0 PBKillIOSync(__A0)
  634. #endif
  635. extern pascal OSErr PBKillIOSync(ParmBlkPtr paramBlock)
  636.  ONEWORDINLINE(0xA006);
  637.  
  638. #if !GENERATINGCFM
  639. #pragma parameter __D0 PBKillIOAsync(__A0)
  640. #endif
  641. extern pascal OSErr PBKillIOAsync(ParmBlkPtr paramBlock)
  642.  ONEWORDINLINE(0xA406);
  643.  
  644. #if !GENERATINGCFM
  645. #pragma parameter __D0 PBKillIOImmed(__A0)
  646. #endif
  647. extern pascal OSErr PBKillIOImmed(ParmBlkPtr paramBlock)
  648.  ONEWORDINLINE(0xA206);
  649. extern pascal short OpenDeskAcc(ConstStr255Param deskAccName)
  650.  ONEWORDINLINE(0xA9B6);
  651. extern pascal void CloseDeskAcc(short refNum)
  652.  ONEWORDINLINE(0xA9B7);
  653. #if CGLUESUPPORTED
  654. extern short opendeskacc(const char *deskAccName);
  655. extern OSErr opendriver(const char *driverName, short *refNum);
  656. #endif
  657. #if OLDROUTINENAMES
  658. /*
  659.     The PBxxx() routines are obsolete.  
  660.     
  661.     Use the PBxxxSync(), PBxxxAsync(), or PBxxxImmed version instead.
  662. */
  663. #define PBControl(pb, async) ((async) ? PBControlAsync(pb) : PBControlSync(pb))
  664. #define PBStatus(pb, async) ((async) ? PBStatusAsync(pb) : PBStatusSync(pb))
  665. #define PBKillIO(pb, async) ((async) ? PBKillIOAsync(pb) : PBKillIOSync(pb))
  666. #if !OLDROUTINELOCATIONS
  667. #define PBOpen(pb, async) ((async) ? PBOpenAsync(pb) : PBOpenSync(pb))
  668. #define PBClose(pb, async) ((async) ? PBCloseAsync(pb) : PBCloseSync(pb))
  669. #define PBRead(pb, async) ((async) ? PBReadAsync(pb) : PBReadSync(pb))
  670. #define PBWrite(pb, async) ((async) ? PBWriteAsync(pb) : PBWriteSync(pb))
  671. #endif
  672. #endif
  673.  
  674. #if PRAGMA_IMPORT_SUPPORTED
  675. #pragma import off
  676. #endif
  677.  
  678. #if PRAGMA_ALIGN_SUPPORTED
  679. #pragma options align=reset
  680. #endif
  681.  
  682. #ifdef __cplusplus
  683. }
  684. #endif
  685.  
  686. #endif /* __DEVICES__ */
  687.